commonlibsse_ng\re\b/
BSTimer.rs

1/// Represents the `BSTimer` class from C++.
2#[repr(C)]
3#[derive(Debug, Clone, Default, PartialEq)]
4pub struct BSTimer {
5    pub unk00: u64,
6    pub lastPerformanceCount: u32,
7    pub clamp: f32,
8    pub clampRemainder: f32,
9    pub delta: f32,
10    pub realTimeDelta: f32,
11    pub unk1C: u32,
12    pub unk20: u32,
13    pub unk24: f32,
14    pub unk28: u32,
15    pub unk2C: u32,
16    pub unk30: u32,
17    pub unk34: u8,
18    pub unk35: u8,
19    pub useGlobalTimeMultiplierTarget: bool,
20    pub pad37: u8,
21    pub pad38: u32,
22
23    pub pad3C: u32,
24}
25
26// Ensure the memory layout matches the C++ struct
27const _: () = {
28    use core::mem::offset_of;
29    assert!(offset_of!(BSTimer, unk00) == 0x00);
30    assert!(offset_of!(BSTimer, lastPerformanceCount) == 0x08);
31    assert!(offset_of!(BSTimer, clamp) == 0xc);
32    assert!(offset_of!(BSTimer, clampRemainder) == 0x10);
33    assert!(offset_of!(BSTimer, delta) == 0x14);
34    assert!(offset_of!(BSTimer, realTimeDelta) == 0x18);
35    assert!(offset_of!(BSTimer, unk1C) == 0x1c);
36    assert!(offset_of!(BSTimer, unk20) == 0x20);
37    assert!(offset_of!(BSTimer, unk24) == 0x24);
38    assert!(offset_of!(BSTimer, unk28) == 0x28);
39    assert!(offset_of!(BSTimer, unk2C) == 0x2c);
40    assert!(offset_of!(BSTimer, unk30) == 0x30);
41    assert!(offset_of!(BSTimer, unk34) == 0x34);
42    assert!(offset_of!(BSTimer, unk35) == 0x35);
43    assert!(offset_of!(BSTimer, useGlobalTimeMultiplierTarget) == 0x36);
44    assert!(offset_of!(BSTimer, pad37) == 0x37);
45    assert!(offset_of!(BSTimer, pad38) == 0x38);
46    assert!(offset_of!(BSTimer, pad3C) == 0x3c);
47
48    assert!(core::mem::size_of::<BSTimer>() == 0x40);
49};
50
51impl BSTimer {
52    /// Gets the singleton instance of `BSTimer`.
53    #[commonlibsse_ng_derive_internal::relocate(
54        cast_as = "*mut BSTimer",
55        default = "None",
56        id(se = 523657, ae = 410196)
57    )]
58    #[inline]
59    pub fn get_singleton() -> Option<&'static BSTimer> {
60        |as_type: AsType| unsafe { as_type.as_ref() }
61    }
62
63    /// Gets the global time multiplier.
64    #[commonlibsse_ng_derive_internal::relocate(
65        cast_as = "*mut f32",
66        default = "None",
67        id(se = 511882, ae = 388442)
68    )]
69    #[inline]
70    pub fn q_global_time_multiplier() -> Option<f32> {
71        |as_type: AsType| unsafe { as_type.as_ref().copied() }
72    }
73
74    /// Gets the target global time multiplier.
75    #[commonlibsse_ng_derive_internal::relocate(
76        cast_as = "*mut f32",
77        default = "None",
78        id(se = 511883, ae = 388443)
79    )]
80    #[inline]
81    pub fn q_global_time_multiplier_target() -> Option<f32> {
82        |as_type: AsType| unsafe { as_type.as_ref().copied() }
83    }
84
85    /// Sets the global time multiplier.
86    #[inline]
87    #[commonlibsse_ng_derive_internal::relocate_fn(se_id = 66988, ae_id = 68245)]
88    pub fn set_global_time_multiplier(&mut self, multiplier: f32, arg2: bool) {}
89}